package dom.domain;

import java.util.ArrayList;
import java.util.Map;

import net.sf.json.JSONObject;

/**
 * User entity. @author MyEclipse Persistence Tools
 */

public class User implements java.io.Serializable {

	// Fields

	private String userId;
	private String psd;
	private String eeid;
	private String admitId;
	private String id;
	private String email;
	private String phoneNo;
	private String userGeneralType;
	private String userSubType;
	private String userPhoto;
	private String userDescribe;
	private String state;
	private String birthday;
	private String policy;
	private String nation;
	private Integer epAllocated;
	private String epyear;
	private String name;
	private Integer epId;
	private Integer provinceId;
	private String gender;
	private Integer admitIdAllocated;

	// Constructors

	/** default constructor */
	public User() {
	}

	/** minimal constructor */
	public User(String userId, String psd, String id, String email,
			String epyear, Integer provinceId) {
		this.userId = userId;
		this.psd = psd;
		this.id = id;
		this.email = email;
		this.epyear = epyear;
		this.provinceId = provinceId;
	}

	/** full constructor */
	public User(String userId, String psd, String eeid, String admitId,
			String id, String email, String phoneNo, String userGeneralType,
			String userSubType, String userPhoto, String userDescribe,
			String state, String birthday, String policy, String nation,
			Integer epAllocated, String epyear, String name, Integer epId,
			Integer provinceId, String gender, Integer admitIdAllocated) {
		this.userId = userId;
		this.psd = psd;
		this.eeid = eeid;
		this.admitId = admitId;
		this.id = id;
		this.email = email;
		this.phoneNo = phoneNo;
		this.userGeneralType = userGeneralType;
		this.userSubType = userSubType;
		this.userPhoto = userPhoto;
		this.userDescribe = userDescribe;
		this.state = state;
		this.birthday = birthday;
		this.policy = policy;
		this.nation = nation;
		this.epAllocated = epAllocated;
		this.epyear = epyear;
		this.name = name;
		this.epId = epId;
		this.provinceId = provinceId;
		this.gender = gender;
		this.admitIdAllocated = admitIdAllocated;
	}

	// Property accessors

	public String getUserId() {
		return this.userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getPsd() {
		return this.psd;
	}

	public void setPsd(String psd) {
		this.psd = psd;
	}

	public String getEeid() {
		return this.eeid;
	}

	public void setEeid(String eeid) {
		this.eeid = eeid;
	}

	public String getAdmitId() {
		return this.admitId;
	}

	public void setAdmitId(String admitId) {
		this.admitId = admitId;
	}

	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPhoneNo() {
		return this.phoneNo;
	}

	public void setPhoneNo(String phoneNo) {
		this.phoneNo = phoneNo;
	}

	public String getUserGeneralType() {
		return this.userGeneralType;
	}

	public void setUserGeneralType(String userGeneralType) {
		this.userGeneralType = userGeneralType;
	}

	public String getUserSubType() {
		return this.userSubType;
	}

	public void setUserSubType(String userSubType) {
		this.userSubType = userSubType;
	}

	public String getUserPhoto() {
		return this.userPhoto;
	}

	public void setUserPhoto(String userPhoto) {
		this.userPhoto = userPhoto;
	}

	public String getUserDescribe() {
		return this.userDescribe;
	}

	public void setUserDescribe(String userDescribe) {
		this.userDescribe = userDescribe;
	}

	public String getState() {
		return this.state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public String getBirthday() {
		return this.birthday;
	}

	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}

	public String getPolicy() {
		return this.policy;
	}

	public void setPolicy(String policy) {
		this.policy = policy;
	}

	public String getNation() {
		return this.nation;
	}

	public void setNation(String nation) {
		this.nation = nation;
	}

	public Integer getEpAllocated() {
		return this.epAllocated;
	}

	public void setEpAllocated(Integer epAllocated) {
		this.epAllocated = epAllocated;
	}

	public String getEpyear() {
		return this.epyear;
	}

	public void setEpyear(String epyear) {
		this.epyear = epyear;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getEpId() {
		return this.epId;
	}

	public void setEpId(Integer epId) {
		this.epId = epId;
	}

	public Integer getProvinceId() {
		return this.provinceId;
	}

	public void setProvinceId(Integer provinceId) {
		this.provinceId = provinceId;
	}

	public String getGender() {
		return this.gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	public Integer getAdmitIdAllocated() {
		return this.admitIdAllocated;
	}

	public void setAdmitIdAllocated(Integer admitIdAllocated) {
		this.admitIdAllocated = admitIdAllocated;
	}
	
	@Override
	public String toString() {
		return "{userId:'" + userId + "', eeid:'" + eeid + "', admitId:'"
				+ admitId + "', id:'" + id + "', email:'" + email
				+ "', phoneNo:'" + phoneNo + "', userPhoto:'" + userPhoto
				+ "', userDescribe:'" + userDescribe + "', state:'" + state
				+ "', birthday:'" + birthday + "', policy:'" + policy
				+ "', nation:'" + nation + "', epyear:'" + epyear + "', name:'"
				+ name + "', provinceId:'" + provinceId + "', gender:'"
				+ gender + "'}";
	}
	public String getString() {
		return "{userId:'" + userId + "', psd:'" + psd + "', eeid:'" + eeid
				+ "', admitId:'" + admitId + "', id:'" + id + "', email:'"
				+ email + "', phoneNo:'" + phoneNo + "', userGeneralType:'"
				+ userGeneralType + "', userSubType:'" + userSubType
				+ "', userPhoto:'" + userPhoto + "', userDescribe:'"
				+ userDescribe + "', state:'" + state + "', birthday:'"
				+ birthday + "', policy:'" + policy + "', nation:'" + nation
				+ "', epAllocated:'" + epAllocated + "', epyear:'" + epyear
				+ "', name:'" + name + "', epId:'" + epId + "', provinceId:'"
				+ provinceId + "', gender:'" + gender + "', admitIdAllocated:'"
				+ admitIdAllocated + "'}";
	}
	public void setUserInfo(ArrayList<String> list,Map<String,String> userInfo)
	{

		for(int i =0;i<list.size();i++)
		{

			if (list.get(i).equals("userId")) {
				this.setUserId(userInfo.get(list.get(i)));
			}
			if (list.get(i).equals("eeid")) {
				this.setEeid(userInfo.get(list.get(i)));
			}
			if(list.get(i).equals("admitId"))
			{
				this.setAdmitId(userInfo.get(list.get(i)));
			}
			if (list.get(i).equals("email")) {
				this.setEmail(userInfo.get(list.get(i)));
			}
			if (list.get(i).equals("id")) {
				this.setId(userInfo.get(list.get(i)));
			}
			if (list.get(i).equals("name")) {
				this.setName(userInfo.get(list.get(i)));
			}
			if (list.get(i).equals("psd")) {
				this.setPsd(userInfo.get(list.get(i)));			
				}
			if (list.get(i).equals("state")) {
				this.setState(userInfo.get(list.get(i)));
			}
			if (list.get(i).equals("userDecribe")) {
				this.setUserDescribe(userInfo.get(list.get(i)));
			}
			if (list.get(i).equals("userGeneralType")) {
				this.setUserGeneralType(userInfo.get(list.get(i)));
			}
			if (list.get(i).equals("userPhoto")) {
				this.setUserPhoto(userInfo.get(list.get(i)));
			}
			if (list.get(i).equals("userSubType")) {
				this.setUserSubType(userInfo.get(list.get(i)));
			}
			if (list.get(i).equals("policy")) {
				this.setPolicy(userInfo.get(list.get(i)));
			}
			if (list.get(i).equals("EPyear")) {
				this.setEpyear(userInfo.get(list.get(i)));
			}
			if (list.get(i).equals("nation")) {
				this.setNation(userInfo.get(list.get(i)));
			}
			if(list.get(i).equals("epId"))
			{
				this.setEpId(Integer.parseInt(userInfo.get(list.get(i))));
			}
			if(list.get(i).equals("provinceId"))
			{
				this.setProvinceId(Integer.parseInt(userInfo.get(list.get(i))));
			}
			if(list.get(i).equals("gender"))
			{
				this.setGender(userInfo.get(list.get(i)));
			}
			if(list.get(i).equals("birthday"))
			{
				this.setBirthday(userInfo.get(list.get(i)));
			}
			if(list.get(i).equals("phoneNo"))
			{
				this.setPhoneNo(userInfo.get(list.get(i)));
			}
		
		}
	
	}
	public void setInfo(ArrayList<String> list,Map<String,String> userInfo)
	{
		for(int i =0;i<list.size();i++)
		{

			if (list.get(i).equals("userId")) {
				this.setUserId(userInfo.get(list.get(i)));
			}
			if (list.get(i).equals("eeid")) {
				this.setEeid(userInfo.get(list.get(i)));
			}
			if(list.get(i).equals("admitId"))
			{
				this.setAdmitId(userInfo.get(list.get(i)));
			}
			if (list.get(i).equals("mail")) {
				this.setEmail(userInfo.get(list.get(i)));
			}
			if (list.get(i).equals("idCardNum")) {
				this.setId(userInfo.get(list.get(i)));
			}
			if (list.get(i).equals("userName")) {
				this.setName(userInfo.get(list.get(i)));
			}
			if (list.get(i).equals("psd")) {
				this.setPsd(userInfo.get(list.get(i)));			
				}
			if (list.get(i).equals("state")) {
				this.setState(userInfo.get(list.get(i)));
			}
			if (list.get(i).equals("userDecribe")) {
				this.setUserDescribe(userInfo.get(list.get(i)));
			}
			if (list.get(i).equals("userGeneralType")) {
				this.setUserGeneralType(userInfo.get(list.get(i)));
			}
			if (list.get(i).equals("userPhoto")) {
				this.setUserPhoto(userInfo.get(list.get(i)));
			}
			if (list.get(i).equals("subject")) {
				this.setUserSubType(userInfo.get(list.get(i)));
			}
			if (list.get(i).equals("policy")) {
				this.setPolicy(userInfo.get(list.get(i)));
			}
			if (list.get(i).equals("EPyear")) {
				this.setEpyear(userInfo.get(list.get(i)));
			}
			if (list.get(i).equals("nation")) {
				this.setNation(userInfo.get(list.get(i)));
			}
			if(list.get(i).equals("epId"))
			{
				this.setEpId(Integer.parseInt(userInfo.get(list.get(i))));
			}
			if(list.get(i).equals("provinceId"))
			{
				this.setProvinceId(Integer.parseInt(userInfo.get(list.get(i))));
			}
			if(list.get(i).equals("gender"))
			{
				this.setGender(userInfo.get(list.get(i)));
			}
			if(list.get(i).equals("birthday"))
			{
				this.setBirthday(userInfo.get(list.get(i)));
			}
			if(list.get(i).equals("phoneNo"))
			{
				this.setPhoneNo(userInfo.get(list.get(i)));
			}
		}
	}
	public ArrayList getInfo(String info) {
		// TODO Auto-generated method stub
		ArrayList<String> list = new ArrayList<String>();
		String[] tinfo = info.split("#");
		JSONObject jInfo = JSONObject.fromObject(this.getString());
		for(int i = 0;i<tinfo.length;i++)
		{
			list.add(jInfo.getString(tinfo[i]));
		}
		return list;
	}
	

}